import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from google.appengine.dist import use_library
use_library('django', '1.2')

from google.appengine.ext.webapp import template


from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app



class MainHandler(webapp.RequestHandler):
  def get(self):
    template_values = {}
    path = os.path.join(os.path.dirname(__file__), 'encode.html')
    self.response.out.write(template.render(path, template_values))
    
class EncodeHandler(webapp.RequestHandler):
  def get(self):
    template_values = {'input' : self.request.get('input')}
    path = os.path.join(os.path.dirname(__file__), 'encode.html')
    self.response.out.write(template.render(path, template_values))



def main():
  application = webapp.WSGIApplication([('/.*', MainHandler),
                                        ('/.*', EncodeHandler)],
                                       debug=True)
  run_wsgi_app(application)

if __name__ == '__main__':
  main()

